package com.clei.utils.container;

/**
 * 一对
 *
 * @param <S> first
 * @param <T> second
 * @author Y
 * @date 2021-12-27
 */
public final class Pair<S, T> {
    /**
     * first
     */
    private final S first;

    /**
     * second
     */
    private final T second;

    private Pair(S first, T second) {
        this.first = first;
        this.second = second;
    }

    public static <S, T> Pair<S, T> of(S first, T second) {
        return new Pair<>(first, second);
    }

    @Override
    public String toString() {
        return String.format("[%s,%s]", first, second);
    }

    public S getFirst() {
        return first;
    }

    public T getSecond() {
        return second;
    }
}

